<?php
    class PageController extends HeheController
    {

        public function filters()
        {
            return array(
                'accessControl', // perform access control for CRUD operations
            );
        }

        public function accessRules()
        {
            return array(
                array('allow',
                    'actions'=>array('index','error', 'about'),
                    'users'=>array('*'),
                ),
                //            array('allow', // allow authenticated user to perform 'create' and 'update' actions
                //                'actions'=>array(),
                //                'users'=>array('@'),
                //            ),
                //            array('deny',  // deny all users
                //                'users'=>array('*'),
                //            ),
            );
        }

        /**
        * This is the action to handle external exceptions.
        */
        public function actionError()
        {
            if($error=Yii::app()->errorHandler->error)
            {
                if(Yii::app()->request->isAjaxRequest)
                    echo $error['message'];
                else{

                    $view = 'error';
                    if(in_array($error['code'], array(404))){
                        $view .= $error['code'];
                    }
                    $this->render($view, $error);
                }     
            }
        }
        
        public function actionIndex(){
            $this->pageTitle = "Index";
            $this->render('index2');
        }
    }
